package com.patelski.magic.controller;

import javax.ejb.Stateful;

import org.jboss.seam.annotations.Name;

import com.patelski.common.controller.StatefulAbstractEntityHomeImpl;
import com.patelski.magic.model.Card;
import com.patelski.magic.model.Edition;
import com.patelski.magic.model.Foil;

@Stateful
@Name("cardHome")
public class CardHomeImpl extends StatefulAbstractEntityHomeImpl<Card> implements
		CardHome {

	private Edition edition;

	@Override
	public Card createInstance() {
		Card card = new Card();
		card.setFoil(Foil.NF);
		return card;
	}

	public Edition getEdition() {
		return edition;
	}

	public void setEdition(Edition edition) {
		this.edition = em.merge(edition);
		if (null != this.edition) {
			this.instance.setEdition(this.getEdition());
		}
	}

}
